/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.beautycenter.ModelosTabela;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;

/**
 *
 * @author JoãoVictor
 */
public class PanelPersonalizado extends JPanel {

    JPanel parent;
    int qtdDesenho;
    int posicao;
    Color cor;

    public PanelPersonalizado(JPanel parent, int qtdDesenho, int posicao, Color cor) {
        this.parent = parent;
        this.qtdDesenho = qtdDesenho;
        this.posicao = posicao;
        this.cor = cor;
        
        setPreferredSize(new Dimension(180, 40));
        setSize(180, 40);
    }
    
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g); //To change body of generated methods, choose Tools | Templates.
        Graphics2D g2d = (Graphics2D) g;
        g2d.setColor(cor);
        
        if(posicao == 0 && qtdDesenho == 2){
            g2d.setColor(cor);
            g2d.fillRect(0, 0, 180, 40);
        }else if(posicao == 0 && qtdDesenho == 1){
            g2d.setColor(cor);
            g2d.fillRect(0, 0, 180, 20);
        }else if(posicao == 1){
            g2d.setColor(cor);
            g2d.fillRect(0, 20, 180, 20);
        }
    }
    
}
